<?php
ob_start();
include_once "FrontendManager.php";
$db_frnmanager = new FrontendManager();

$f1 = $_POST["f1"];
$f2 = $_POST["f2"];



/*
<div class="row clearfix">
            <div class="col-md-6 column">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">
                    Panel title
                  </h3>
                </div>
                <div class="panel-body" id="chart4">
                  <script type="text/javascript">

$(document).ready(function(){
   s1 = [52200];
 
   plot4 = $.jqplot('chart4',[s1],{
       seriesDefaults: {
           renderer: $.jqplot.MeterGaugeRenderer,
           rendererOptions: {
               label: 'Velocidad Promedio',
               labelPosition: 'bottom',
               labelHeightAdjust: -5,
               intervalOuterRadius: 85,
               ticks: [10000, 30000, 50000, 70000],
               intervals:[22000, 55000, 70000],
               intervalColors:['#66cc66', '#E7E658', '#cc6666']
           }
       }
   });
});
                  </script>
                </div>
                <div class="panel-footer">
                  Panel footer
                </div>
              </div>
            </div>
            <div class="col-md-6 column">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">
                    Panel title
                  </h3>
                </div>
                <div class="panel-body">
                  Panel content
                </div>
                <div class="panel-footer">
                  Panel footer
                </div>
              </div>
            </div>
          </div>
          <div class="row clearfix">
            <div class="col-md-6 column">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">
                    Panel title
                  </h3>
                </div>
                <div class="panel-body">
                  Panel content
                </div>
                <div class="panel-footer">
                  Panel footer
                </div>
              </div>
            </div>
            <div class="col-md-6 column">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">
                    Panel title
                  </h3>
                </div>
                <div class="panel-body">
                  Panel content
                </div>
                <div class="panel-footer">
                  Panel footer
                </div>
              </div>
            </div>
          </div>
          <div class="row clearfix">
            <div class="col-md-6 column">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">
                    Panel title
                  </h3>
                </div>
                <div class="panel-body">
                  Panel content
                </div>
                <div class="panel-footer">
                  Panel footer
                </div>
              </div>
            </div>
            <div class="col-md-6 column">
              <div class="panel panel-default">
                <div class="panel-heading">
                  <h3 class="panel-title">
                    Panel title
                  </h3>
                </div>
                <div class="panel-body">
                  Panel content
                </div>
                <div class="panel-footer">
                  Panel footer
                </div>
              </div>
            </div>
          </div>
            </div>
            <div class="panel-footer">
              Grafica Resultante
            </div>


*/








echo "<table class=\"table\">
            <thead>
              <tr>
                <th>
                  Estadistica
                </th>
                <th>
                  Valor
                </th>               
              </tr>
            </thead>
            <tbody>";

            $result = $db_frnmanager->getEstadisticasTiempoReal($f1, $f2);
              while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_NUMERIC) ) {                
                echo "<tr class=\"active\">";
                  echo "<td>Velocidad Promedio</td>";
                  echo "<td>" . $row[0] . "</td>";
                echo "</tr>";
                echo "<tr class=\"active\">";
                echo "<td>Unidades Producidas</td>";
                  echo "<td>" . $row[1] . "</td>";
                echo "</tr>";
                echo "<tr class=\"active\">";
                  echo "<td>Unidades Desperdicio</td>";
                  echo "<td>" . $row[2] . "</td>";
                echo "</tr>";
                echo "<tr class=\"active\">";
                  echo "<td>Numero de Paros</td>";
                  echo "<td>" . $row[3] . "</td>";
                echo "</tr>";
                echo "<tr class=\"active\">";
                  echo "<td>Tiempo Muerto en Minutos</td>";
                  echo "<td>" . $row[4] . "</td>";
                echo "</tr>";
                echo "<tr class=\"active\">";
                  echo "<td>Tiempo Muerto en Segundos</td>";
                  echo "<td>" . $row[5] . "</td>";
                echo "</tr>";
                break;
              }
  echo "</tbody>
  </table>";
  
  ?> 